
#include <limits.h>
#include <stdio.h>

#include "range.hpp"

namespace imp {

	/* = Constructors ======================================================= */
	Range::Range() : start(0), end(0) {
	}

	Range::Range(int start, int end) {
		this->start = start;
		this->end = end;
	}

	/* = Methods ============================================================ */
	 int Range::size() const {
		return (this->end - this->start) + 1;
	}

	Range Range::all() {
		return Range(INT_MIN, INT_MAX);
	}

	void Range::print() {
		int i;
		printf("[ ");
		for (i = start; i < end; ++i) {
			printf("%d ", i);
		}
		printf("%d ]", end);
	}

	/* = Operators ========================================================== */
	static bool operator ==(Range& r1, Range& r2) {
		return ( r1.start == r2.start && r1.end == r2.end);
	}

	static bool operator !=(Range& r1, Range& r2) {
		return !(r1 == r2);
	}

}
